
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c:choose >
    <c:when test="${ not empty username}">
        
        Date Buy :<input type="text" name="txtSearch" id="txtSearch" />
        <input type="button" name="btSearch" id="btSearch" value="Search" onclick="loadsearchorderhistory(getvalue('btSearch'),getvalue('txtSearch'))" />
        <c:choose >
            <c:when test="${action == null}">
<jsp:useBean id="marshallorder" class="Model.marshallXML" scope="request"/>
<%
        marshallorder.marshallOrder(application.getRealPath("/") + "XML/Orderxml.xml", session.getAttribute("username").toString());
        
%>
<c:import var="xmldoc" url="XML/Orderxml.xml" />
<c:import var="xsldoc" url="xsl/Printorderhistory.xsl" />
<x:transform xml="${xmldoc}" xslt="${xsldoc}" />
        </c:when>
        <c:otherwise>
            <table style="width:500px" border="1">
                <tr style="color:white;font-weight: bold;" bgcolor="#1B9BE0">
                    <td><center>No.</center></td>
                    <td><center>Date buy</center></td>
                    <td><center>Receive</center></td>
                    <td><center>PrintPDF</center></td>
                </tr>
                <c:forEach var="ac" items="${action}" varStatus="counter">
                    <tr style="color:black">
                        <td>${counter.count}</td>
                        <c:set var="string1" value="${ac.orderDate}" />
                        <c:set var="string2" value="${fn:replace(ac.orderDate,'T', ' ')}" />
                        <td>${string2}</td>
                        <td><c:choose > <c:when test="${ac.orderStatus==1}">Yes</c:when><c:otherwise>No</c:otherwise> </c:choose></td>
                        <td><a target="_blank" href="PrintOrderHistory?idorder=${ac.orderID}">PrintPDF</a></td>
                    </tr>
                </c:forEach>
            </table>
        <%
        session.removeAttribute("action");
%>
</c:otherwise>
        </c:choose>


</c:when>
    <c:otherwise>
        <h1 style="color: red">Login before View Order History.</h1>
    </c:otherwise>
</c:choose>
